Release 10.1A: OpenEdge Development:
Progress 4GL Reference


SAVE( ) method

Saves or sends an XML document.

Return type: LOGICAL

Applies to: X-document object handle

Syntax
SAVE( mode , { file | stream | memptr| longchar } ) 

mode

A character expression that evaluates to one of the following: “FILE”, “STREAM”, “MEMPTR”, or “LONGCHAR”. The mode indicates whether the XML target is a file, a stream, a MEMPTR, or a LONGCHAR variable.

file

A character expression that represents the name of a new file to be created in current working directory of the underlying operating system’s file system. If a file with the specified name already exists, Progress verifies that the file is writeable and overwrites the file.

stream

A character expression that represents the name of a 4GL stream. If stream is "", Progress saves the document to the 4GL session unnamed stream.

memptr

A MEMPTR variable to contain the saved XML text in memory. The SAVE method allocates the required amount of memory and sets the size of the variable. You must release the memory later with a SET-SIZE( ) = 0.

longchar

A LONGCHAR variable to contain the saved XML text in memory.

Progress saves the LONGCHAR variable in the code page of the XML document, as determined by the XML document’s ENCODING attribute. If the XML document’s ENCODING attribute has not been set, the LONGCHAR variable is saved in UTF-8.

If the LONGCHAR variable’s code page is fixed (that is, set using the FIX-CODEPAGE function) and the fixed code page is not equivalent to the encoding specified in the XML document’s ENCODING attribute, the SAVE( ) method returns an error and the XML document is not saved to the LONGCHAR.

Example

The following code fragments demonstrate the use of the SAVE( ) method:

/* Saves the current tree under hDoc as memo.xml. */
DEFINE STREAM mystream.
OUTPUT STREAM mystream to memo.xml.
hdoc:SAVE("stream","mystream").

OR

/* Saves the current tree under hDoc as memo.xml. */
hdoc:SAVE("file","memo.xml").

OR

/* Saves the current tree under hDoc in memory referred to by mymem. */
DEFINE VARIABLE hDoc AS HANDLE.
DEFINE VARIABLE mymem AS MEMPTR.
. . .
hDoc:SAVE("memptr", mymem). 

See also

ENCODING attribute


Copyright © 2005 Progress Software Corporation
www.progress.com
Voice: (781) 280-4000
Fax: (781) 280-4095